package cn.cdqf.kjxz.controller;

import cn.cdqf.globle.common.ResultResponse;
import cn.cdqf.kjxz.util.FastDFSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class FileController {
    @Autowired
    private FastDFSUtils fastDFSUtils;

    @PostMapping("file")
    public ResultResponse upload(@RequestPart MultipartFile multipartFile) throws IOException {
        String s = fastDFSUtils.uploadFile(multipartFile);
        return ResultResponse.success(s);
    }
}
